<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT" />










<meta name="description" content="####1. 距离传感器12345678910111213141516171819202122232425#import &amp;quot;ViewController.h&amp;quot;@implementation ViewController- (void)viewDidLoad &amp;#123;    [super viewDidLoad];        //1. 开启距离传感器    [UIDevi">
<meta name="keywords" content="Android、iOS、Web、React Native">
<meta property="og:type" content="article">
<meta property="og:title" content="iOS-Motion(传感器)">
<meta property="og:url" content="http://yoursite.com/blog/2018/08/06/iOS-Special-Function/iOS-Motion(传感器)/index.html">
<meta property="og:site_name" content="凌浩雨_博客">
<meta property="og:description" content="####1. 距离传感器12345678910111213141516171819202122232425#import &amp;quot;ViewController.h&amp;quot;@implementation ViewController- (void)viewDidLoad &amp;#123;    [super viewDidLoad];        //1. 开启距离传感器    [UIDevi">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2018-08-06T10:55:12.584Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="iOS-Motion(传感器)">
<meta name="twitter:description" content="####1. 距离传感器12345678910111213141516171819202122232425#import &amp;quot;ViewController.h&amp;quot;@implementation ViewController- (void)viewDidLoad &amp;#123;    [super viewDidLoad];        //1. 开启距离传感器    [UIDevi">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/blog/2018/08/06/iOS-Special-Function/iOS-Motion(传感器)/"/>





  <title>iOS-Motion(传感器) | 凌浩雨_博客</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="default">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">凌浩雨_博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            Archives
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/blog/blog/2018/08/06/iOS-Special-Function/iOS-Motion(传感器)/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="凌浩雨">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/blog/images/avatar.jpeg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="凌浩雨_博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">iOS-Motion(传感器)</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2018-08-06T18:01:38+08:00">
                2018-08-06
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>####1. 距离传感器<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line">#import &quot;ViewController.h&quot;</span><br><span class="line"></span><br><span class="line">@implementation ViewController</span><br><span class="line"></span><br><span class="line">- (void)viewDidLoad &#123;</span><br><span class="line">    [super viewDidLoad];</span><br><span class="line">    </span><br><span class="line">    //1. 开启距离传感器</span><br><span class="line">    [UIDevice currentDevice].proximityMonitoringEnabled = YES;</span><br><span class="line">    </span><br><span class="line">    //2. 注册通知</span><br><span class="line">    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(proximityStateDidChangeNotification) name:UIDeviceProximityStateDidChangeNotification object:nil];</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">#pragma mark 通知的方法</span><br><span class="line">- (void)proximityStateDidChangeNotification &#123;</span><br><span class="line">    //3. 获取通知的值</span><br><span class="line">    if ([UIDevice currentDevice].proximityState) &#123;</span><br><span class="line">        NSLog(@&quot;有逗比靠近&quot;);</span><br><span class="line">    &#125; else &#123;</span><br><span class="line">        NSLog(@&quot;逗比被吓跑了&quot;);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">@end</span><br></pre></td></tr></table></figure></p>
<a id="more"></a>
<p>####2. 加速计<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br></pre></td><td class="code"><pre><span class="line">#import &quot;ViewController.h&quot;</span><br><span class="line">#import &lt;CoreMotion/CoreMotion.h&gt;</span><br><span class="line"></span><br><span class="line">//CoreMotion框架 加速计 陀螺仪 磁力计</span><br><span class="line"></span><br><span class="line">/**</span><br><span class="line"> 加速计 : 检测力在某个方向上有作用 (摇一摇)</span><br><span class="line"> 陀螺仪 : 检测转动的角速度 (绕着Y轴旋转, 玩手机赛车游戏)</span><br><span class="line"> 磁力计 : 检测磁场变化, 主要用于导航</span><br><span class="line"> */</span><br><span class="line"></span><br><span class="line">@interface ViewController ()</span><br><span class="line"></span><br><span class="line">/** 运动管理器对象*/</span><br><span class="line">@property (nonatomic, strong) CMMotionManager *motionMgr;</span><br><span class="line"></span><br><span class="line">@end</span><br><span class="line"></span><br><span class="line">@implementation ViewController</span><br><span class="line"></span><br><span class="line">- (void)viewDidLoad &#123;</span><br><span class="line">    [super viewDidLoad];</span><br><span class="line">    [self accelerometerPush];</span><br><span class="line">//    [self accelerometerPull];</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (void)touchesBegan:(NSSet&lt;UITouch *&gt; *)touches withEvent:(UIEvent *)event</span><br><span class="line">&#123;</span><br><span class="line">    //1. 点击时获取加速计的值</span><br><span class="line">    // 运动管理器会记录所有的值, 在自己的属性中</span><br><span class="line">    CMAcceleration acceleration = self.motionMgr.accelerometerData.acceleration;</span><br><span class="line">    NSLog(@&quot;x : %f, y : %f, z : %f&quot;, acceleration.x, acceleration.y, acceleration.z);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">- (void)accelerometerPull</span><br><span class="line">&#123;</span><br><span class="line">    /**</span><br><span class="line">     加速计Pull方式 --&gt; 在需要的时候来获取值</span><br><span class="line">     */</span><br><span class="line">    //1. 创建CMMotionManager对象</span><br><span class="line">    self.motionMgr = [CMMotionManager new];</span><br><span class="line"></span><br><span class="line">    //2. 判断加速计是否可用</span><br><span class="line">    if (![self.motionMgr isAccelerometerAvailable]) &#123;</span><br><span class="line">        return;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    //3. 开始采样</span><br><span class="line">    [self.motionMgr startAccelerometerUpdates];</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (void)accelerometerPush &#123;</span><br><span class="line">    /**</span><br><span class="line">       加速计Push方式</span><br><span class="line">    */</span><br><span class="line">    //1. 创建CMMotionManager对象</span><br><span class="line">    self.motionMgr = [CMMotionManager new];</span><br><span class="line">    </span><br><span class="line">    //2. 判断加速计是否可用</span><br><span class="line">    if (![self.motionMgr isAccelerometerAvailable]) &#123;</span><br><span class="line">        return;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    //3. 设置采样间隔 单位是秒 --&gt; 只有push方式需要采样间隔</span><br><span class="line">    self.motionMgr.accelerometerUpdateInterval = 1;</span><br><span class="line">    </span><br><span class="line">    //4. 开始采样</span><br><span class="line">    [self.motionMgr startAccelerometerUpdatesToQueue:[NSOperationQueue new] withHandler:^(CMAccelerometerData * _Nullable accelerometerData, NSError * _Nullable error) &#123;</span><br><span class="line">        </span><br><span class="line">        //5 获取data中的数据值</span><br><span class="line">        </span><br><span class="line">        // 正值负值: 轴的方向, 哪个指向地面, 就会打印出打个方向的值</span><br><span class="line">        // 只要在某个轴上, 进行快速移动, 那么值就会发生变化</span><br><span class="line">        CMAcceleration acceleration = accelerometerData.acceleration;</span><br><span class="line">        </span><br><span class="line">        NSLog(@&quot;x : %f, y : %f, z : %f&quot;, acceleration.x, acceleration.y, acceleration.z);</span><br><span class="line">        </span><br><span class="line">    &#125;];</span><br><span class="line">&#125;</span><br><span class="line">@end</span><br></pre></td></tr></table></figure></p>
<p>####3. 陀螺仪<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">#import &quot;ViewController.h&quot;</span><br><span class="line">#import &lt;CoreMotion/CoreMotion.h&gt;</span><br><span class="line"></span><br><span class="line">//CoreMotion框架 加速计 陀螺仪 磁力计</span><br><span class="line"></span><br><span class="line">/**</span><br><span class="line"> 加速计 : 检测力在某个方向上有作用 (摇一摇)</span><br><span class="line"> 陀螺仪 : 检测转动的角速度 (绕着Y轴旋转, 玩手机赛车游戏)</span><br><span class="line"> 磁力计 : 检测磁场变化, 主要用于导航</span><br><span class="line"> */</span><br><span class="line"></span><br><span class="line">@interface ViewController ()</span><br><span class="line"></span><br><span class="line">/** 运动管理器对象*/</span><br><span class="line">@property (nonatomic, strong) CMMotionManager *motionMgr;</span><br><span class="line"></span><br><span class="line">@end</span><br><span class="line"></span><br><span class="line">@implementation ViewController</span><br><span class="line"></span><br><span class="line">- (void)viewDidLoad &#123;</span><br><span class="line">    [super viewDidLoad];</span><br><span class="line">    [self gyroPush];</span><br><span class="line">    [self gyroPull];</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (void)touchesBegan:(NSSet&lt;UITouch *&gt; *)touches withEvent:(UIEvent *)event</span><br><span class="line">&#123;</span><br><span class="line">    //1. 点击时获取陀螺仪的值</span><br><span class="line">    CMRotationRate rotationRate = self.motionMgr.gyroData.rotationRate;   </span><br><span class="line">    NSLog(@&quot;x : %f, y : %f, z : %f&quot;, rotationRate.x, rotationRate.y, rotationRate.z);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (void)gyroPush</span><br><span class="line">&#123;</span><br><span class="line">    /**</span><br><span class="line">     陀螺仪Push方式</span><br><span class="line">     */</span><br><span class="line">    //1. 创建CMMotionManager对象</span><br><span class="line">    self.motionMgr = [CMMotionManager new];</span><br><span class="line">    </span><br><span class="line">    //2. 判断陀螺仪是否可用</span><br><span class="line">    if (![self.motionMgr isGyroAvailable]) &#123;</span><br><span class="line">        return;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    //3. 设置采样间隔 单位是秒 --&gt; 只有push方式需要采样间隔</span><br><span class="line">    self.motionMgr.gyroUpdateInterval = 1;</span><br><span class="line">    </span><br><span class="line">    //4. 开始采样</span><br><span class="line">    [self.motionMgr startGyroUpdatesToQueue:[NSOperationQueue new] withHandler:^(CMGyroData * _Nullable gyroData, NSError * _Nullable error) &#123;</span><br><span class="line">        </span><br><span class="line">        //5 获取data中的数据值</span><br><span class="line">        </span><br><span class="line">        // 正值负值: 轴的方向, 哪个指向地面, 就会打印出打个方向的值</span><br><span class="line">        // 只要在某个轴上, 进行快速移动, 那么值就会发生变化</span><br><span class="line">        CMRotationRate rotationRate = gyroData.rotationRate;</span><br><span class="line">        </span><br><span class="line">        NSLog(@&quot;x : %f, y : %f, z : %f&quot;, rotationRate.x, rotationRate.y, rotationRate.z);</span><br><span class="line">        </span><br><span class="line">    &#125;];</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (void)gyroPull</span><br><span class="line">&#123;</span><br><span class="line">    /**</span><br><span class="line">     加速计Pull方式 --&gt; 在需要的时候来获取值</span><br><span class="line">     */</span><br><span class="line">    //1. 创建CMMotionManager对象</span><br><span class="line">    self.motionMgr = [CMMotionManager new];</span><br><span class="line">    </span><br><span class="line">    //2. 判断加速计是否可用</span><br><span class="line">    if (![self.motionMgr isGyroAvailable]) &#123;</span><br><span class="line">        return;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    //3. 开始采样</span><br><span class="line">    [self.motionMgr startGyroUpdates];</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">@end</span><br></pre></td></tr></table></figure></p>
<p>####4. 磁力计<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">#import &quot;ViewController.h&quot;</span><br><span class="line">#import &lt;CoreMotion/CoreMotion.h&gt;</span><br><span class="line">//CoreMotion框架 加速计 陀螺仪 磁力计</span><br><span class="line">/**</span><br><span class="line"> 加速计 : 检测力在某个方向上有作用 (摇一摇)</span><br><span class="line"> 陀螺仪 : 检测转动的角速度 (绕着Y轴旋转, 玩手机赛车游戏)</span><br><span class="line"> 磁力计 : 检测磁场变化, 主要用于导航</span><br><span class="line"> */</span><br><span class="line"></span><br><span class="line">@interface ViewController ()</span><br><span class="line"></span><br><span class="line">/** 运动管理器对象*/</span><br><span class="line">@property (nonatomic, strong) CMMotionManager *motionMgr;</span><br><span class="line"></span><br><span class="line">@end</span><br><span class="line"></span><br><span class="line">@implementation ViewController</span><br><span class="line"></span><br><span class="line">- (void)viewDidLoad &#123;</span><br><span class="line">    [super viewDidLoad];</span><br><span class="line">    </span><br><span class="line">    /**</span><br><span class="line">     磁力计Pull方式 --&gt; 在需要的时候来获取值</span><br><span class="line">     */</span><br><span class="line">    //1. 创建CMMotionManager对象</span><br><span class="line">    self.motionMgr = [CMMotionManager new];</span><br><span class="line">    </span><br><span class="line">    //2. 判断磁力计是否可用</span><br><span class="line">    if (![self.motionMgr isMagnetometerAvailable]) &#123;</span><br><span class="line">        return;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    //3. 开始采样</span><br><span class="line">    [self.motionMgr startMagnetometerUpdates];</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (void)touchesBegan:(NSSet&lt;UITouch *&gt; *)touches withEvent:(UIEvent *)event</span><br><span class="line">&#123;</span><br><span class="line">    //1. 点击时获取磁力计的值</span><br><span class="line">    //单位特斯拉, 不是车</span><br><span class="line">    CMMagneticField magneticField = self.motionMgr.magnetometerData.magneticField;</span><br><span class="line">    </span><br><span class="line">    NSLog(@&quot;x : %f, y : %f, z : %f&quot;, magneticField.x, magneticField.y, magneticField.z);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">@end</span><br></pre></td></tr></table></figure></p>
<p>####5. 小球移动<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br></pre></td><td class="code"><pre><span class="line">#import &quot;ViewController.h&quot;</span><br><span class="line">#import &lt;CoreMotion/CoreMotion.h&gt;</span><br><span class="line"></span><br><span class="line">@interface ViewController ()</span><br><span class="line"></span><br><span class="line">@property (weak, nonatomic) IBOutlet UIImageView *ballView;</span><br><span class="line"></span><br><span class="line">/** 运动管理器*/</span><br><span class="line">@property (nonatomic, strong) CMMotionManager *motionManager;</span><br><span class="line"></span><br><span class="line">/** 此属性用来记录加速计的值*/</span><br><span class="line">@property (nonatomic, assign) CGPoint ballPoint;</span><br><span class="line"></span><br><span class="line">@end</span><br><span class="line"></span><br><span class="line">@implementation ViewController</span><br><span class="line"></span><br><span class="line">- (void)viewDidLoad &#123;</span><br><span class="line">    [super viewDidLoad];</span><br><span class="line">    </span><br><span class="line">    /**</span><br><span class="line">     思路分析</span><br><span class="line">     1. 涉及到了x, y轴</span><br><span class="line">     2. 加速计的x, y值 来进行叠加 --&gt; CoreMotion push方式的加速计</span><br><span class="line">     3. 叠加之后赋值给frame即可</span><br><span class="line">     4. 需要属性来记录加速计的两个值</span><br><span class="line">     */</span><br><span class="line">    </span><br><span class="line">    //1. 创建管理器对象</span><br><span class="line">    self.motionManager = [CMMotionManager new];</span><br><span class="line">    </span><br><span class="line">    //2. 判断加速计是否可用</span><br><span class="line">    if (![self.motionManager isAccelerometerAvailable]) &#123;</span><br><span class="line">        NSLog(@&quot;不能&quot;);</span><br><span class="line">        return;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    //3. 设置采样间隔</span><br><span class="line">    self.motionManager.accelerometerUpdateInterval = 1.0 / 20.0;</span><br><span class="line">    </span><br><span class="line">    //4. 开始采样 --&gt; push方式, 使用的是下面这种方式</span><br><span class="line">    [self.motionManager startAccelerometerUpdatesToQueue:[NSOperationQueue new] withHandler:^(CMAccelerometerData * _Nullable accelerometerData, NSError * _Nullable error) &#123;</span><br><span class="line">        if (error) &#123;</span><br><span class="line">            NSLog(@&quot;error: %@&quot;,error);</span><br><span class="line">            return;</span><br><span class="line">        &#125;</span><br><span class="line">        </span><br><span class="line">        // 5. 调用方法, 来完成小球相关的逻辑代码</span><br><span class="line">        [self accelerationUpdate:accelerometerData.acceleration];</span><br><span class="line">    &#125;];</span><br><span class="line">    </span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">#pragma mark 此方法处理小球相关的逻辑</span><br><span class="line">- (void)accelerationUpdate:(CMAcceleration)acceleration &#123;</span><br><span class="line">    //更改小球的位置变化 --&gt; 值从加速计的值来获取的</span><br><span class="line">    //Frame    加速计的值  叠加值</span><br><span class="line">    //100  --&gt; 1   --&gt; 101</span><br><span class="line">    //101 --&gt; 3 --&gt; 104</span><br><span class="line">    //104 --&gt; 5  --&gt; 109</span><br><span class="line">    </span><br><span class="line">    // 如果不发生运动, 加速计的值, 默认在1~-1之间</span><br><span class="line">    </span><br><span class="line">    //1. 叠加加速计的值 --&gt; 才能有用加速的效果</span><br><span class="line">//    _ballPoint.x =</span><br><span class="line">    </span><br><span class="line">    CGRect frame = self.view.frame;</span><br><span class="line">    frame.size.height = 30;</span><br><span class="line">    self.view.frame = frame;</span><br><span class="line">    </span><br><span class="line">//    self.ballPoint.x =3;</span><br><span class="line">    </span><br><span class="line">    _ballPoint.x += acceleration.x;</span><br><span class="line">    _ballPoint.y -= acceleration.y;</span><br><span class="line">    </span><br><span class="line">    // 上一次的速度 + 加速度 = 当前的速度</span><br><span class="line">    // 上一次的位置 + 位移 = 当前的位置</span><br><span class="line">    // ballPoint.x 和 ballPoint.y 存放的是速度</span><br><span class="line">    // ballFrame.x 和 ballFrame.y 存放的是位置</span><br><span class="line">    // 位移 = 速度 * 时间</span><br><span class="line">    </span><br><span class="line">    NSLog(@&quot;_ballPoint: %@&quot;,NSStringFromCGPoint(self.ballPoint));</span><br><span class="line">    </span><br><span class="line">    //2. 修改Frame</span><br><span class="line">    CGRect ballFrame = self.ballView.frame;</span><br><span class="line">    ballFrame.origin.x += _ballPoint.x;</span><br><span class="line">    ballFrame.origin.y += _ballPoint.y;</span><br><span class="line">    </span><br><span class="line">    //判断边界的问题</span><br><span class="line">    if (ballFrame.origin.x &lt;= 0) &#123;</span><br><span class="line">        </span><br><span class="line">        //99 -100 ==-1?</span><br><span class="line">        //0 + 100 = 100</span><br><span class="line">        ballFrame.origin.x = 0;</span><br><span class="line">        </span><br><span class="line">        //在这里将小球的加速值取反 --&gt; 为的是更改下一次的frame --&gt; 模拟了碰撞现象</span><br><span class="line">        //还要进行*= 0.7 操作, 以为着反弹之后, 小球不会返回原来的位置 --&gt; 模拟重力现象</span><br><span class="line">        _ballPoint.x *= -0.7;</span><br><span class="line">    &#125; else if (ballFrame.origin.x &gt; (self.view.frame.size.width - ballFrame.size.width)) &#123;</span><br><span class="line">        </span><br><span class="line">        //374 + 100 = 474?</span><br><span class="line">        //375 - 100 = 275</span><br><span class="line">        </span><br><span class="line">        ballFrame.origin.x = self.view.frame.size.width - ballFrame.size.width;</span><br><span class="line">        _ballPoint.x *= -0.7;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    if (ballFrame.origin.y &lt;= 0) &#123;</span><br><span class="line">    </span><br><span class="line">        ballFrame.origin.y = 0;</span><br><span class="line">        _ballPoint.y *= -0.7;</span><br><span class="line">    &#125; else if (ballFrame.origin.y &gt; (self.view.frame.size.height - ballFrame.size.height)) &#123;</span><br><span class="line">        </span><br><span class="line">        ballFrame.origin.y = self.view.frame.size.height - ballFrame.size.height;</span><br><span class="line">        _ballPoint.y *= -0.7;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    </span><br><span class="line">    //3. 重设frame 主界面中更新</span><br><span class="line">    dispatch_sync(dispatch_get_main_queue(), ^&#123;</span><br><span class="line">        self.ballView.frame = ballFrame;</span><br><span class="line">    &#125;);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">@end</span><br></pre></td></tr></table></figure></p>
<p>####6. 摇一摇<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line">#import &quot;ViewController.h&quot;</span><br><span class="line"></span><br><span class="line">@interface ViewController ()</span><br><span class="line"></span><br><span class="line">@end</span><br><span class="line"></span><br><span class="line">@implementation ViewController</span><br><span class="line"></span><br><span class="line">- (void)viewDidLoad &#123;</span><br><span class="line">    [super viewDidLoad];</span><br><span class="line">    </span><br><span class="line">    // 摇一摇在iOS中的2种实现方式</span><br><span class="line">    //1. 加速计的值 --&gt; 默认不动手机,1~-1 , 如果摇动了手机, 值会增大</span><br><span class="line">    //可以取绝对值, 自行判断(譬如, 值大于5, 就认为是动摇了)</span><br><span class="line">    </span><br><span class="line">    //2. 系统已经封装号的摇动方法</span><br><span class="line">    </span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event</span><br><span class="line">&#123;</span><br><span class="line">    NSLog(@&quot;摇一摇&quot;);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event</span><br><span class="line">&#123;</span><br><span class="line">    NSLog(@&quot;取消摇动&quot;);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event</span><br><span class="line">&#123;</span><br><span class="line">    NSLog(@&quot;摇动结束&quot;);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">@end</span><br></pre></td></tr></table></figure></p>
<p>####7. 计步器<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br></pre></td><td class="code"><pre><span class="line">#import &quot;ViewController.h&quot;</span><br><span class="line">#import &lt;CoreMotion/CoreMotion.h&gt;</span><br><span class="line"></span><br><span class="line">@interface ViewController ()</span><br><span class="line"></span><br><span class="line">@property (weak, nonatomic) IBOutlet UILabel *label;</span><br><span class="line"></span><br><span class="line">@property (nonatomic, strong) CMPedometer *pedometer;</span><br><span class="line"></span><br><span class="line">@end</span><br><span class="line"></span><br><span class="line">@implementation ViewController</span><br><span class="line"></span><br><span class="line">- (void)viewDidLoad &#123;</span><br><span class="line">    [super viewDidLoad];</span><br><span class="line">    </span><br><span class="line">    //iOS8的 计步器</span><br><span class="line">    //1. 判断硬件是否可用</span><br><span class="line">    if (![CMPedometer isStepCountingAvailable]) &#123;</span><br><span class="line">        return;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    //2. 创建计步器的类</span><br><span class="line">    self.pedometer = [CMPedometer new];</span><br><span class="line">    </span><br><span class="line">    //3. 开始计步统计</span><br><span class="line">    [self.pedometer startPedometerUpdatesFromDate:[NSDate date] withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) &#123;</span><br><span class="line">        </span><br><span class="line">        </span><br><span class="line">        // 4. 主线程中去更新UI</span><br><span class="line">        NSNumber *number = pedometerData.numberOfSteps;</span><br><span class="line">        [self performSelectorOnMainThread:@selector(updateUI:) withObject:number waitUntilDone:NO];</span><br><span class="line">        </span><br><span class="line">    &#125;];</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (void)updateUI:(NSNumber *)number</span><br><span class="line">&#123;</span><br><span class="line">    self.label.text = [NSString stringWithFormat:@&quot;您当前一共走了%@步&quot;,number];</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (void)setpCounter &#123;</span><br><span class="line">    //iOS7的 计步器</span><br><span class="line">    if (![CMStepCounter isStepCountingAvailable]) &#123;</span><br><span class="line">        return;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    CMStepCounter *stepCounter = [CMMotionManager new];</span><br><span class="line">    </span><br><span class="line">    [stepCounter startStepCountingUpdatesToQueue:[NSOperationQueue new] updateOn:5 withHandler:^(NSInteger numberOfSteps, NSDate * _Nonnull timestamp, NSError * _Nullable error) &#123;</span><br><span class="line">        NSLog(@&quot;numberSteps: %zd&quot;, numberOfSteps);</span><br><span class="line">    &#125;];</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">@end</span><br></pre></td></tr></table></figure></p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2018/08/06/iOS-Special-Function/iOS-MapView(定位)/" rel="next" title="iOS-MapView(定位)">
                <i class="fa fa-chevron-left"></i> iOS-MapView(定位)
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2018/08/06/iOS-Special-Function/iOS-Notification(本地通知)/" rel="prev" title="iOS-Notification(本地通知)">
                iOS-Notification(本地通知) <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      

      <section class="site-overview-wrap sidebar-panel sidebar-panel-active">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/blog/images/avatar.jpeg"
                alt="凌浩雨" />
            
              <p class="site-author-name" itemprop="name">凌浩雨</p>
              <p class="site-description motion-element" itemprop="description">专业从事于移动端开发，Android与iOS均有涉及，主做Android开发与React Native开发</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blog/archives/">
              
                  <span class="site-state-item-count">393</span>
                  <span class="site-state-item-name">posts</span>
                </a>
              </div>
            

            

            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">凌浩雨</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/blog/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
